package cn.lanqiao.springboot.controller;

import cn.lanqiao.springboot.service.ArticleService;
import cn.lanqiao.springboot.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/a")
public class ArticleController {

    @Autowired
    ArticleService articleService;

    //
    @GetMapping("/like/{articleId}/{userId}")
    public Result like(@PathVariable int articleId,@PathVariable int userId) {
        articleService.doLike(articleId, userId);
        return Result.success();
    }

    @GetMapping("/buy/{goodsId}")
    public Result like(@PathVariable int goodsId) {
        articleService.buy(goodsId,2);

        return Result.success();
    }
}
